﻿@{
    Bundle("jquery_validate");
    Layout = "_Layout.cshtml";
}


<script type="text/javascript">
    jQuery(document).ready(function () {
        jQuery('@ID("#tabs")').tabs();
    });
</script>
<div id="@ID("tabs")">
    <ul>
        <li><a href="@ID("#tab_1")">*</a></li>
    </ul>
    <div id="@ID("tab_1")">
    @if(Model != null)
    {
        <script type="text/javascript">
            jQuery(document).ready(function() {
                jQuery('@ID("#form")').validate({
                    rules: {
                        weight: {
                            required: true
                        },
                        length: {
                            required: true
                        },
                        width: {
                            required: true
                        },
                        height: {
                            required: true
                        }
                    }
                });
            });
        </script>
        <form id="@ID("form")" action="@Url.Action(Loc.Act("Update").Ctrl("ItemSpecDimensional"))" method="post">
            <input type="hidden" name="id" value="@JDM.Int32(Model.EntityID)" />
            <input type="hidden" name="commonFlags" value="None" />
            <table>
                <tr>
                    <td>
                        <label>#</label>
                    </td>
                    <td>
                        <input type="text" readonly name="id" value="@JDM.Int32(Model.EntityID)" />
                    </td>
                </tr>
                <tr>
                    <td>
                        <label>&#10001;</label>
                    </td>
                    <td>
                        <input type="text" readonly value="@Svc.DateTime((DateTime)JDM.DateTime(Model.CreatedOn))" />
                    </td>
                </tr>
                <tr>
                    <td>
                        <label>&#10002;</label>
                    </td>
                    <td>
                        <input type="text" readonly value="@Svc.DateTime((DateTime)JDM.DateTime(Model.UpdatedOn))" />
                    </td>
                </tr>
                <tr>
                    <td>
                        <a href="@Url.Action(Loc.Act("Edit").Ctrl("Item").Set(new
                        {
                            id = JDM.Int32(Model.Item.EntityID)
                        }))" class="ui-icon ui-icon-extlink"></a>
                        <label>@T(Res.Name("Item"))</label>
                    </td>
                    <td>
                        <input type="text" readonly value="@JDM.Int32(Model.Item.EntityID)" />
                    </td>
                </tr>
                <tr>
                    <td>
                        <label>@T(Res.In("Common").Of("Vocab").Name("SKU"))</label>
                    </td>
                    <td>
                        <input type="text" name="sku" value="@JDM.String(Model.SKU)" maxlength="100" />
                    </td>
                </tr>
                <tr>
                    <td>
                        <label>@T(Res.Name("Weight"))</label>
                    </td>
                    <td>
                        <input type="text" name="weight" value="@Svc.Weight((decimal)JDM.Decimal(Model.Weight))" />
                    </td>
                </tr>
                <tr>
                    <td>
                        <label>@T(Res.Name("Length"))</label>
                    </td>
                    <td>
                        <input type="text" name="length" value="@Svc.Dimension((decimal)JDM.Decimal(Model.Length))" />
                    </td>
                </tr>
                <tr>
                    <td>
                        <label>@T(Res.Name("Width"))</label>
                    </td>
                    <td>
                        <input type="text" name="width" value="@Svc.Dimension((decimal)JDM.Decimal(Model.Width))" />
                    </td>
                </tr>
                <tr>
                    <td>
                        <label>@T(Res.Name("Height"))</label>
                    </td>
                    <td>
                        <input type="text" name="height" value="@Svc.Dimension((decimal)JDM.Decimal(Model.Height))" />
                    </td>
                </tr>
                <tr>
                    <td>
                        <label>@T(Res.In("API").Of("Enum").Of("CatalogItemSpecFlags").Name("Active"))</label>
                    </td>
                    <td>
                        <input type="checkbox" name="commonFlags" value="Active" @(JDM.String(Model.CommonFlags).Contains("Active") ? "checked" : String.Empty) />
                    </td>
                </tr>
            </table>
            <ul class="bar toolbar">
                <li>
                    <button class="button" type="submit">@T(Res.In("Common").Of("Act").Name("Submit"))</button>
                </li>
            </ul>
        </form>
    }
    else
    {
        <script type="text/javascript">
            jQuery(document).ready(function() {
                jQuery('@ID("#form")').validate({
                    rules: {
                        itemID: {
                            digits: true,
                            required: true
                        },
                        weight: {
                            required: true
                        },
                        length: {
                            required: true
                        },
                        width: {
                            required: true
                        },
                        height: {
                            required: true
                        }
                    }
                });
            });
        </script>
        <form id="@ID("form")" action="@Url.Action(Loc.Act("Create").Ctrl("ItemSpecDimensional"))" method="post">
            <input type="hidden" name="commonFlags" value="None" />
            <table>
                <tr>
                    <td>
                        <label>@T(Res.Name("Item"))</label>
                    </td>
                    <td>
                        <input type="text" name="itemID" />
                    </td>
                </tr>
                <tr>
                    <td>
                        <label>@T(Res.In("Common").Of("Vocab").Name("SKU"))</label>
                    </td>
                    <td>
                        <input type="text" name="sku" maxlength="100" />
                    </td>
                </tr>
                <tr>
                    <td>
                        <label>@T(Res.Name("Weight"))</label>
                    </td>
                    <td>
                        <input type="text" name="weight" value="@Svc.Weight(Decimal.Zero)" />
                    </td>
                </tr>
                <tr>
                    <td>
                        <label>@T(Res.Name("Length"))</label>
                    </td>
                    <td>
                        <input type="text" name="length" value="@Svc.Dimension(Decimal.Zero)" />
                    </td>
                </tr>
                <tr>
                    <td>
                        <label>@T(Res.Name("Width"))</label>
                    </td>
                    <td>
                        <input type="text" name="width" value="@Svc.Dimension(Decimal.Zero)" />
                    </td>
                </tr>
                <tr>
                    <td>
                        <label>@T(Res.Name("Height"))</label>
                    </td>
                    <td>
                        <input type="text" name="height" value="@Svc.Dimension(Decimal.Zero)" />
                    </td>
                </tr>
                <tr>
                    <td>
                        <label>@T(Res.In("API").Of("Enum").Of("CatalogItemSpecFlags").Name("Active"))</label>
                    </td>
                    <td>
                        <input type="checkbox" name="commonFlags" value="Active" />
                    </td>
                </tr>
            </table>
            <ul class="bar toolbar">
                <li><button class="button" type="submit">@T(Res.In("Common").Of("Act").Name("Submit"))</button></li>
            </ul>
        </form>
    }
    </div>
</div>